from sklearn.cross_validation import train_test_split
import sklearn.preprocessing as prep
import numpy as np
random_seed = 1225

def random_split_train_val(train_xy):
    train_xy = train_xy.drop(['uid'], axis = 1)
    train, val = train_test_split(train_xy, test_size=0.2, random_state=random_seed)
    y = train.y
    X = train.drop(['y'], axis = 1)
    val_y = val.y
    val_X = val.drop(['y'], axis = 1)
    return (X,y),(val_X,val_y)

def scale_X(X):
    #TODO:use trainset's mean and std or testset's on testset? NO use in XGB
    return prep.scale(X)

def log_X(X):
    return np.log(X)

def square_root_X(X):
    return np.sqrt(X)
